<%@page isELIgnored="false" contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="/header.jsp" %>
<c:url value="/backend/CategoryAdmin" var="backUrl" />


<c:choose>
    <c:when test="${category == null}">
        <div id="breadcrump">
            <ul id="breadcrump-list">
                <li>&raquo; Product beheer</li>
            </ul>
        </div>
        Categorie niet gevonden. <a href="${backUrl}">Terug</a>
    </c:when>
    <c:otherwise>
        <c:url value="/backend/NewProduct" var="newProductUrl">
            <c:param name="category_id" value="${category.id}" />
        </c:url>
        
        <div id="breadcrump">
            <ul id="breadcrump-list">
                <li>&raquo; Product beheer (${fn:escapeXml(category.name)})</li>
            </ul>
        </div>
      
        <a href="${newProductUrl}">Nieuw product</a>
        <table border="1">
            <tr>
                <th>Naam</th>
                <th></th>
                <th></th>
            </tr>
            <c:forEach var="product" items="${products}">
                <c:url value="/backend/EditProduct" var="editProductUrl">
                    <c:param name="product_id" value="${product.id}" />
                </c:url>
                <c:url value="/backend/EditProductImage" var="editImgUrl">
                    <c:param name="product_id" value="${product.id}" />
                </c:url>
                
                <tr>
                    <td>${fn:escapeXml(product.name)}</td>
                    <td><a href="${editProductUrl}">Gegevens wijzigen</a></td>
                    <td><a href="${editImgUrl}">Afbeelding wijzigen</a></td>
                </tr>
            </c:forEach>
        </table>
        <a href="${backUrl}">Terug</a>
    </c:otherwise>
</c:choose>

<%@include file="/footer.jsp" %>